/*
 * TCSS 558
 * Distributed HashMap
 * Fall 2013
 * James Marquardt
 * Matt Adams
 * Justin Wong
 */
package registry;
import java.rmi.Remote;
import java.rmi.RemoteException;

import model.HostPort;

/**
 * The interface to a service that manages interactions for the distributed hashtable.
 * 
 * @author James Marquardt
 * @author Matt Adams
 * @author Justin Wong
 */
public interface RemoteRegistry extends Remote {
	
	/**
	 * Adds an actual node to the service.
	 * @param the_cur_node The node being added.
	 * @return the id of the node
	 * @throws RemoteException if there is a problem with method call.
	 */
	RegistrationPacket registerNode(HostPort the_hostPort) throws RemoteException, NodeLocationException;
	
	/**
	 * Retrieves m value of the chord.
	 * 
	 * @return the chord's m value.
	 */
	int getMValue() throws RemoteException;
	
	/**
	 * Gets the HostPort of a node in the registry.
	 * 
	 * @param the_node_id The id of the node.
	 * @return The hostport of the node.
	 * @throws RemoteException if there is a problem with the call.
	 */
	HostPort getNodeHostPort(int the_node_id) throws RemoteException;
	
	/**
	 * Returns the id of an arbitrary registered node.
	 * 
	 * @return The id of the arbitrary node
	 * @throws RemoteException if there is a problem with the call.
	 */
	public int getArbitraryNode() throws RemoteException;
	
	/**
	 * Removes the specified node from the registry.
	 * 
	 * @param the_node_id The id of the node being removed.
	 * @throws RemoteException If there is a problem with the call.
	 */
	public void removeNode(int the_node_id) throws RemoteException;

}
